package com.tinywind.Sword.Dto;

import java.util.ArrayList;
import java.util.List;


/**
 * 封装json对象，所有返回结果都使用它
 * 如果是数组放在List数组中.
 * 如果是字典放在Obj中.
 */
public class Data<T> {
	public List<T> items;
	public T item;
	public Page page;
	public int itemCount;
	
	public Data(List<T> list,Page page) {
		this.items = list;
		this.page = page;
		this.itemCount = list.size();
	}
	
	public Data(List<T> list) {
		this.items = list;
		this.page = null;
	}
	
	public Data(T item) {
//		ArrayList<T> al = new ArrayList<T>();
//		al.add(item);
//		this.items = al;
		this.item = item;
		Page page = new Page(0,1,1);
		this.page = page;
		this.itemCount = 1;
	}
}

